{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="tu_status" lay-search="" class="layui-input">
                                <option  value="">全部支付状态</option>
                                <option  value="2">已完成支付</option>
                                <option  value="1">未完成支付</option>
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>
            <p style="font-size: 16px;font-weight: bold;">平台总利润：{$allmoney['allmoney']} 元</p>
            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.s_image}}" class="layui-table-img layui-cricle" onerror="this.src='/static/admin/images/head_default.gif'"/>
                    </script>
                    <script type="text/html" id="fenpei1">
                        {{# if(d.tu_super_yes ==1){ }}
                        未接受
                        {{# } else if(d.tu_super_yes== 2) { }}
                        {{d.task_super_first_money}}
                        {{# } else { }}
                        已拒绝
                        {{# } }}
                    </script>
                    <script type="text/html" id="fenpei11">
                        {{# if(d.tu_super_yes ==1){ }}
                        未接受
                        {{# } else if(d.tu_super_yes== 2) { }}
                        {{d.tu_receive_time}}
                        {{# } else { }}
                        已拒绝
                        {{# } }}
                    </script>
                    <script type="text/html" id="fenpei2">
                        {{# if(d.tu_status ==2){ }}
                        {{d.task_price-d.task_super_first_money-d.task_super_admin_money}}
                        {{# } else { }}
                        未完成
                        {{# } }}
                    </script>
                    <script type="text/html" id="fenpei22">
                        {{# if(d.tu_status ==2){ }}
                        {{d.tu_do_time}}
                        {{# } else { }}
                        未完成
                        {{# } }}
                    </script>
                    <script type="text/html" id="supertype">
                        {{# if(d.is_super ==1){ }}
                        普通达人
                        {{# } }}
                        {{# if(d.is_super ==2){ }}
                        超级达人
                        {{# } }}
                    </script>
                    <script type="text/html" id="tu_status">
                        {{# if(d.tu_status ==2){ }}
                        是
                        {{# } else { }}
                        否
                        {{# } }}
                    </script>

                    <!--操作模板-->

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("supermoney/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 70, title: '序号'}
                , {field: 'task_number', width: 200, title: '任务包编号', align: 'center'}
                , {field: 's_name', width: 200, title: '商家名称', align: 'center'}
                , {field: 'sup_name', width: 200, title: '达人姓名', align: 'center'}
                , {field: 'sup_phone', width: 200, title: '达人手机', align: 'center'}
                , {field: 'is_super', width: 200, title: '达人类型', align: 'center',templet:'#supertype'}
                , {field: 'task_name', width: 200, title: '任务名称', align: 'center'}
                , {field: 'task_price', width: 100, title: '任务金额', align: 'center'}
                , {field: 'task_super_admin_money', width: 200, title: '平台利润', align: 'center'}
                , {field: 'tu_super_yes', width: 200, title: '第一笔发放金额', align: 'center',templet:'#fenpei1'}
                , {field: 'tu_super_yes', width: 200, title: '第一笔发放时间', align: 'center',templet:'#fenpei11'}
                , {field: 'tu_super_yes', width: 200, title: '第二笔发放金额', align: 'center',templet:'#fenpei2'}
                , {field: 'tu_super_yes', width: 200, title: '第二笔发放时间', align: 'center',templet:'#fenpei22'}
                , {field: 'tu_status', width: 200, title: '是否完成支付', align: 'center',templet:'#tu_status'}
            ]]
            ,done: function (res, curr, count) {
                $('.layui-cricle').viewer();//图片查看器
            }
        });


        //批量操作
        var $ = layui.$, active = {
            excelAll: function(){
                //导出Excel
                wk.excelAll(getIds(),$('.layui-input').serialize(),"{:url('excelMember')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['task_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>